<% title @article.name %>

<p class="author"><em>from <%=h @article.author_name %></em></p>

<%= simple_format @article.content %>

<p>
  <% if can? :update, @article %>
    <%= link_to "Edit", edit_article_path(@article) %> |
  <% end %>
  <% if can? :destroy, @article %>
    <%= link_to "Destroy", @article, :method => :delete, :confirm => "Are you sure?" %> |
  <% end %>
  <%= link_to "Back to Articles", articles_path %>
</p>

<% unless @article.comments.empty? %>
  <h2><%= pluralize(@article.comments.size, 'comment') %></h2>

  <div id="comments">
  <% for comment in @article.comments %>
    <div class="comment">
      <strong><%= link_to_unless comment.site_url.blank?, h(comment.author_name), h(comment.site_url) %></strong>
      <em>on <%= comment.created_at.strftime('%b %d, %Y at %H:%M') %></em>
      <%=simple_format comment.content %>
      <p>
        <% if can? :update, comment %>
          <%= link_to "Edit", edit_comment_path(comment) %>
        <% end %>
        <% if can? :destroy, comment %>
          | <%= link_to "Destroy", comment, :method => :delete, :confirm => "Are you sure?" %>
        <% end %>
      </p>
    </div>
  <% end %>
  </div>
<% end %>

<h3>Add your comment:</h3>
<%= render :partial => 'comments/form' %>
